import socket

import redis
from redis.asyncio import from_url

from config import settings

sync_cli = redis.from_url(
    settings.redis.uri,
    password=settings.redis.password,
    decode_responses=True,
    socket_keepalive=True,
    socket_keepalive_options={
        socket.TCP_KEEPIDLE: 60,
        socket.TCP_KEEPCNT: 30,
        socket.TCP_KEEPINTVL: 3
    }
)
async_cli = from_url(
    settings.redis.uri,
    password=settings.redis.password,
    decode_responses=True,
    socket_keepalive=True,
    socket_keepalive_options={
        socket.TCP_KEEPIDLE: 60,
        socket.TCP_KEEPCNT: 30,
        socket.TCP_KEEPINTVL: 3
    }
)
